package com.neuedu.weishi.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.weishi.entity.VideoCategory;
import com.neuedu.weishi.service.IVideoCategoryService;
import com.neuedu.weishi.vo.ResponseData;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Author lu
 * Date   2025-08-26 09:11:00
 */
@Log4j2
@RequestMapping("/weishi/video/category/api")
@RestController
@Tag(name = "控制器")
public class VideoCategoryController {

    @Autowired
    @Qualifier("videoCategoryService")
    private IVideoCategoryService videoCategoryService;

    /**
     * 查询视频分类
     *
     * @return
     */
    @GetMapping("/list")
    @Operation(summary = "查询视频分类列表")
    public ResponseData selectList() {
        QueryWrapper<VideoCategory> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("status", 1);
        queryWrapper.orderByAsc("index");
        List<VideoCategory> list = videoCategoryService.list(queryWrapper);
        return ResponseData.success(list);
    }

}